Skip to content

SD-1460 - fix: don't drop track format on run nodes#1850

Open
chittolinag wants to merge 4 commits intomainfrom
gabriel/sd-1460-bug-text-with-tracked-style-change-from-word-and-sd-is
Open

SD-1460 - fix: don't drop track format on run nodes#1850
chittolinag wants to merge 4 commits intomainfrom
gabriel/sd-1460-bug-text-with-tracked-style-change-from-word-and-sd-is

Conversation

@chittolinag
Copy link
Contributor

Tracked formatting changes were being dropped after export.

The reason is that we were not re-generating the rPrChange element before decoding the run node. We do encode them correctly, but we were just missing doing it in the opposite direction.

@linear
Copy link

linear bot commented Jan 27, 2026

* @returns {Object|undefined} Properties element for trackFormat change or undefined.
*/
export const createTrackStyleMark = (marks) => {
export const decodeTrackFormatMark = (marks) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed this - the current name seems counter-intuitive, it's not creating a mark, but instead decoding it back to OOXML.

Thoughts?

@chittolinag chittolinag marked this pull request as ready for review January 27, 2026 16:18
@chittolinag chittolinag changed the title fix: don't drop track format on run nodes SD-1460 - fix: don't drop track format on run nodes Jan 27, 2026
Copy link
Contributor

@caio-pizzol caio-pizzol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approach looks right — adding w:rPrChange generation at the r-translator.decode level is the correct place for this. left one inline comment worth addressing before merge: trackFormat marks aren't excluded from preservedMarks the same way trackInsert and trackDelete are, which is inconsistent with the function's intent. the fix is a one-liner. everything else looks good.

(mark) => mark?.type === TrackInsertMarkName || mark?.type === TrackDeleteMarkName,

const trackingMarks = marks.filter((mark) =>
[TrackInsertMarkName, TrackDeleteMarkName, TrackFormatMarkName].includes(mark?.type),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trackFormat is now collected into trackingMarksByType here, but the preservedMarks filter on line ~42 still only removes trackInsert and trackDelete — so trackFormat ends up in both places and gets pushed onto children too. nothing downstream processes it today, so no duplicate output — but it's inconsistent with the function's intent. worth aligning the preservedMarks filter too?

const preservedMarks = marks
  .filter((mark) => ![TrackInsertMarkName, TrackDeleteMarkName, TrackFormatMarkName].includes(mark?.type))
  .map((mark) => cloneMark(mark));

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tupizz 👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants